# -*- mode: python ; coding: utf-8 -*-
"""
JAR包更新工具 - PyInstaller 配置文件
可以直接使用此spec文件构建: pyinstaller jar-updater.spec
"""

import os
import sys

block_cipher = None

# 收集所有需要的数据文件
datas = [
    ('../templates', 'templates'),
    ('../static', 'static'),
    ('../tools', 'tools'),
]

# 隐藏导入的模块
hiddenimports = [
    'openpyxl',
    'xlrd', 
    'pandas',
    'flask',
    'werkzeug',
    'jinja2',
    'rarfile',
    'tkinter',
    'tkinter.filedialog',
    'tkinter.ttk',
    'tkinter.messagebox',
    'tkinter.scrolledtext',
    'numpy',
    'markupsafe',
    'itsdangerous',
    'click',
]

a = Analysis(
    ['../src/main.py'],
    pathex=[],
    binaries=[],
    datas=datas,
    hiddenimports=hiddenimports,
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='JAR-Updater',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,  # No console window (GUI mode)
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon='../docs/img/update.png' if os.path.exists('../docs/img/update.png') else None,
)

